package com.sanjiahantang.youjiarole.module.goods.beans;

import com.google.gson.Gson;
import com.sanjiahantang.youjiarole.base.BaseBean;
import com.sanjiahantang.youjiarole.module.common.beans.ConditionBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zy on 2017/10/23.
 */

public class GoodsSelectorBean extends BaseBean {
    private String data;

    public Data getData() {
        return new Gson().fromJson(data,Data.class);
    }

    public void setData(String data) {
        this.data = data;
    }

    public static class Data{
        private List<Band> goodsBrandList;
        private List<ConditionBean.SelectorData> goodsStyleList;
        private List<Category> categoryList;


        public List<ConditionBean.SelectorData> getGoodsBrandList() {
            if (goodsBrandList == null){
                return null;
            }
            List<ConditionBean.SelectorData> list = new ArrayList<>();
            for (int i = 0,max = goodsBrandList.size();i < max;i++){
                ConditionBean.SelectorData selectorData = new ConditionBean.SelectorData();
                selectorData.setDicName(goodsBrandList.get(i).getBrandName());
                selectorData.setDicValue(String.valueOf(goodsBrandList.get(i).getMbId()));
                selectorData.setDicCode(String.valueOf(goodsBrandList.get(i).getMbId()));
                list.add(selectorData);
            }
            return list;
        }

        public void setGoodsBrandList(List<Band> goodsBrandList) {
            this.goodsBrandList = goodsBrandList;
        }

        public List<ConditionBean.SelectorData> getGoodsStyleList() {
            return goodsStyleList;
        }

        public void setGoodsStyleList(List<ConditionBean.SelectorData> goodsStyleList) {
            this.goodsStyleList = goodsStyleList;
        }

        public List<Category> getCategoryList() {
            return categoryList;
        }

        public void setCategoryList(List<Category> categoryList) {
            this.categoryList = categoryList;
        }
    }

    public static class Band{
        private String brandName;
        private int mbId;

        public String getBrandName() {
            return brandName;
        }

        public void setBrandName(String brandName) {
            this.brandName = brandName;
        }

        public int getMbId() {
            return mbId;
        }

        public void setMbId(int mbId) {
            this.mbId = mbId;
        }
    }

    public static class Category{
        private String name;
        private String mgcId;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getMgcId() {
            return mgcId;
        }

        public void setMgcId(String mgcId) {
            this.mgcId = mgcId;
        }
    }
}
